﻿using Lg.Core.SMS.YM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lg.Core.SMS
{
    public class SMSFactory
    {
        string provider = "ym";
        public SMSFactory(string provider) {
          this.provider = provider.ToLower();
        }
        public ISMS CreateSMS()
        {
            switch (this.provider)
            {
                case "ym":
                    return new YM.SMS();
                case "aliyun":
                    return new YM.SMS();
                default:
                    throw new Exception($"短信提供者身份[Provider:{this.provider}]无法识别,创建SMS对像失败");
            }
        }
        public ISMS CreateSMS(SMSConfigFileTypeOptions fileType,string? filePath=null)
        {
            switch (this.provider)
            {
                case "ym":
                    return new YM.SMS(fileType,filePath);
                case "aliyun":
                    return new YM.SMS(fileType, filePath);
                default:
                    throw new Exception($"短信提供者身份[Provider:{this.provider}]无法识别,创建SMS对像失败");
            }
        }
        public ISMS CreateSMS(IConfigEntity config)
        {
            switch (this.provider)
            {
                case "ym":
                    return new YM.SMS((YMConfigEntity)config);
                case "aliyun":
                    return new YM.SMS();
                default:
                    throw new Exception($"短信提供者身份[Provider:{this.provider}]无法识别,创建SMS对像失败");
            }
        }
    }
}
